package com.college.common.config;


import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 小C工作室
 * @Date: 2021/9/15 13:06
 * @description: 配置CORS跨域支持 访问控制拦截器
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

	/**
	 * 配置跨域访问支持
	 *
	 * @param registry
	 */
	@Override
	public void addCorsMappings(CorsRegistry registry) {
		registry.addMapping("/**")
				.allowedOrigins("*")
				.allowedHeaders("*")
				.allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS")
				.maxAge(3600);
	}


}
